11. 火车接入
11.1 设置火车remote view
/**
* 设置火车remote view
*/
AiTrain.getInstance().setTrainRemoteViewImpl(AbsTrainRemoteView)
/**
* 火车view
*/
public abstract class AbsTrainRemoteView {
/**
* 显示查询到的火车信息
*
* @param bean 火车数据
*/
public void showTrainList(Train bean) {
}
/**
* 语音通知翻页,用户输入上一页或者下一页或者第几页操作时回调
*
* @param int 页码,取值0-2,需要执行翻页操作
*/
public void voicePageTurn(int num){
}
}
public class Train implements Parcelable {
/**
* 出发城市
*/
private String startCity;
/**
* 到达城市
*/
private String endCity;
/**
* 查询时间
*/
private String queryTime;
/**
* 火车详细数据
*/
private ArrayList<TrainItem> beans;
}
public class TrainItem implements Parcelable {
/**
* 起始站
*/
private String currentStartStationName;
/**
* 终点站
*/
private String currentEndStationName;
/**
* 出发时间
*/
private String startTime;
/**
* 到达时间
*/
private String endTime;
/**
* 火车型号,如K289
*/
private String trainNumber;
/**
* 火车型号中文,如 快速 特快等
*/
private String trainTypeName;
/**
* 总时间,注意单位为秒,需要自行转换
*/
private String runTime;
/**
* 余票信息
*/
private ArrayList<TrainSeat> trainSeatBeans;
}
public class TrainSeat implements Parcelable {
/**
* 票价
*/
private String seatPrice;
/**
* 余票信息
*/
private String remainderTrainTickets;
/**
* 类型,如硬座 一等座等
*/
private String seatName;
}
11.2 火车view翻页通知语音
UI翻页时需要将当前页码的index设置给语音, 语音需要该页码index来保证"上一页/下一页"指令的正确性.
/**
* @param pageIndex 翻页后的页码 index=[0~2]
*/
AiTrain.getInstance().setPageTurn(int pageIndex)
Tips: 默认列表暂时只支持3x3显示, 且index取值从0开始, 所以pageIndex只取0~2范围